#!/usr/bin/env python
# test only one instance
import os
import sys
import time
from datetime import datetime
import argparse
import socket
import stats_request
from scripts.test import SDNTester
from config import config

strategies=[
{'topo':config.coord_test_case,'switch': ['{controllers[0]},2,*,of_echo_reply,3,LIE,act==&val=0'],'host':None},
{'topo':config.coord_test_case,'switch': ['{controllers[0]},2,*,of_echo_reply,3,LIE,act==&val=32000'],'host':None},
{'topo':config.coord_test_case,'switch': ['{controllers[0]},2,*,of_echo_reply,3,LIE,act==&val=65535'],'host':None}
]
def test():
    print(config.logs_loc)
def main():
	#Open Log file
    lg = open("/home/agentmanager/SDNST/log/inst0.log", 'w')
    lg.write(str(datetime.today()) + "\n")
    lg.write("Controller: " + config.controller_type + "\n")
    mininet = [1]
    controllers = [2]
    tester = SDNTester(mininet,controllers,lg)
    print "Starting Tests..."
    #Success
    # res = tester.doTest({'topo':config.coord_test_case,'switch':['{controllers[0]},1,*,of_port_status,2,LIE,act==&val=128'],'host':None})
    #Failed
    res = tester.doTest({'topo':config.coord_test_case,'switch':['{controllers[0]},1,*,of_desc_stats_request,2,LIE,act==&val=0'],'host':None})
    # for stra in strategies:
        # res = tester.doTest(stra)
    # for stra in stats_request.stats_request:
    #     res = tester.doTest(stra)

    print "Test Result: " + str(res[0])

if __name__ == "__main__":
	main()
    # test()
